<?php

/*
	[77zy_xgrids] (C) 2009 77zy.cn
	You can modify this plugin WITHOUT removing or changing the copyright.

	Author: shines
	Version: 1.0.0
*/

if(!defined('IN_DISCUZ') || !defined('IN_ADMINCP')) {
	exit('Access Denied');
}

if(!submitcheck('yessubmit') && !submitcheck('nosubmit')) {
	cpmsg(getconfirmmsg(), '', 'error', 
		"<form action=\"$BASESCRIPT?action=plugins&operation=pluginuninstall&dir=$dir&installtype=$installtype\" method=\"post\">".
		"<input type=\"hidden\" name=\"formhash\" value=\"".FORMHASH."\" />".
		"<input type=\"submit\" class=\"btn\" name=\"yessubmit\" value=\" $lang[yes] \" /> &nbsp; ".
		"<input type=\"submit\" class=\"btn\" name=\"nosubmit\" value=\" $lang[no] \" />".
		"</form>");
} elseif (submitcheck('nosubmit')) {
	//runquery($sql);
}

$finish = true;

function getconfirmmsg() {

	global $charset;
	$defaultmsg = 'Do you want to reserve your 77zy_xgrids data?';

	switch(strtolower($charset)) {
		case 'gbk': $xmlfile = 'discuz_plugin_77zy_xgrids_SC_GBK.xml'; break;
		case 'big5': $xmlfile = 'discuz_plugin_77zy_xgrids_TC_BIG5.xml'; break;
		case 'utf-8': $xmlfile = 'discuz_plugin_77zy_xgrids_SC_UTF8.xml'; break;
		default: return $defaultmsg;
	}

	$xmlfile = dirname(__FILE__).'/'.$xmlfile;

	if(!$fp = @fopen($xmlfile, 'rb')) {
		return $defaultmsg;
	}

	$filesize = filesize($xmlfile);
	$filedata = fread($fp, $filesize);
	fclose($fp);

	if(!function_exists('xml2array')) {
		include_once DISCUZ_ROOT.'./admin/xml.class.php';
	}

	$xmldata = xml2array($filedata);
	$xmlmsg = $xmldata['Data']['language']['scriptlang']['uninstall_reserve'];

	return $xmlmsg ? $xmlmsg : $defaultmsg;

}

?>